import Vue from 'vue'
import VueRouter from 'vue-router'
//登录
import Login from '../views/login.vue'
//导航
import Nav from '../components/nav.vue'
// 个人信息
import Person from '../views/person.vue'
//首页
import Index from '../views/index.vue'
// 表单数量
import FormNum from '../views/FormNumber.vue'
// 表单审批
import FormExa from '../views/FormExamine.vue'
// 设备归还
import EquipmentRet from '../views/EquipmentReturn.vue'
// 设备信息
import EquipmentMes from '../views/EquipmentMessage.vue'
// 账号管理
import Account from '../views/Account.vue'


Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/nav',
},
  {
  path: '/login',
  name: '登录',
  component: Login,
  meta: {
    requireAuth: false
  },
  hidden: true
  },
  {
  path: '/nav',
  name: '框架',
  component: Nav,
  meta: {
    requireAuth: false
  },
  hidden: true,
  redirect: '/index',
  children: [{
    path: '/index',
    name: '首页',
    component: Index,
    meta: {
      requireAuth: false
    },
    hidden: true
  },
  {
    path: '/person',
    name: '个人信息页面',
    component: Person,
    meta: {
     requireAuth: false
    },
    hidden: true
  },
  {
    path: '/FormNumber',
    name: '表单数量页面',
    component: FormNum,
    meta: {
      requireAuth: false
    },
    hidden: true
  },
  {
    path: '/FormExamine',
    name: '表单审批页面',
    component: FormExa,
    meta: {
     requireAuth: false
    },
    hidden: true
  },{
    path: '/EquipmentReturn',
    name: '设备归还页面',
    component: EquipmentRet,
    meta: {
     requireAuth: false
    },
    hidden: true
  },{
    path: '/EquipmentMessage',
    name: '设备信息页面',
    component: EquipmentMes,
    meta: {
     requireAuth: false
    },
    hidden: true
  },{
    path: '/Account',
    name: '账号管理页面',
    component: Account,
    meta: {
     requireAuth: false
    },
    hidden: true
  },
  
]
}, ]

const router = new VueRouter({
  routes
})

// // 挂载路由导航守卫
// router.beforeEach((to, from, next) => {
//   // to 将要访问的路径
//   // from 代表从那个路径跳转的
//   // next 是一个函数，表示放行
//   //   next 放行      next("/login")  强制跳转
//   if (to.path === '/login') return next();

//   const tokenStr = window.sessionStorage.getItem('token')
//   if (!tokenStr) return next('/login')
//   next()
// })

export default router
